package com.panda.web.controller.commons;

import com.panda.common.core.domain.R;
import com.panda.web.domain.dto.ProductDTO;
import com.panda.web.domain.dto.TrendDTO;
import com.panda.web.domain.dto.commons.FeedbackDTO;
import com.panda.web.domain.vo.commons.BackGroundVO;
import com.panda.web.domain.vo.commons.FeedbackVO;
import com.panda.web.domain.vo.product.ProductVO;
import com.panda.web.entity.commons.WebFeedback;
import com.panda.web.service.commons.BackgroundService;
import com.panda.web.service.commons.WebFeedbackService;
import com.panda.web.utils.pageutils.PageResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@Slf4j
@CrossOrigin
@RestController
@RequestMapping("/feedback")
public class WebFeedbackController {

    @Autowired
    WebFeedbackService feedbackService;

    /**
     * 反馈列表
     */
    @GetMapping("/list")
    public PageResult<FeedbackVO> List(FeedbackDTO dto,
                                       @RequestParam("pageNum") Integer pageNum,
                                       @RequestParam("pageSize") Integer pageSize) {
        //返回分页信息
        PageResult<FeedbackVO> voList = feedbackService.PageList(dto,pageNum,pageSize);
        return voList;
    }

    /**
     * 新增反馈
     */
    @PostMapping("/inster")
    public R insterFeedback(@RequestBody FeedbackDTO dto){
        return R.ok(feedbackService.insterFeedback(dto),200,"ok");
    }

}
